home *** CD-ROM | disk | FTP | other *** search
- Path: alterdial.uu.net!not-for-mail
- From: andrew kennedy <"andrew kennedy"@hlp.com>
- Newsgroups: comp.lang.c
- Subject: Help
- Date: Wed, 10 Apr 1996 15:03:47 -0700
- Message-ID: <316C3043.A5D@hlp.com>
- NNTP-Posting-Host: public.hlp.com
- Mime-Version: 1.0
- Content-Type: multipart/mixed; boundary="------------66794A10240E"
- X-Mailer: Mozilla 2.01 (Win16; I)
-
- This is a multi-part message in MIME format.
-
- --------------66794A10240E
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
-
- I wrote this code early in my C career, but there should be a better to
- do this. Can someone help.
-
- --------------66794A10240E
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- Content-Disposition: inline; filename="PROB"
-
-
- if( !strchr(file_name, '.')) /*if file has no extension, take on .enc*/
- {
- strcpy(name1,file_name);
- strcpy(name2,file_name);
- strcat(name2, ".enc");
- }
- else
- {
- strcpy(name1, file_name);
- strcpy(name2, file_name);
- strrev(name2); /* reverse string i.e. hello = olleh */
- rev_string = strpbrk(name2,".");
- /* make rev_string contain only those */
- /* characters on right side of period */
- /* and then take off the period */
-
- /* works ONLY with file names with */
- /* the underscore, alphabetic and */
- /* numeric characters */
-
- rev_string = strpbrk(rev_string,"abcdefghijklmnopqrstuvwxyz_0123456789");
- strrev(rev_string); /* reverse string again to get only */
- strcpy(name2,rev_string);/* filename without it's extension */
- strcat(name2, ".enc"); /* copy .enc extension onto name2 */
- }
-
- --------------66794A10240E--
-
-